test

6.5 调试JRockit Mission Control

通过命令jrmc启动JRockit Mission Control时,附加参数-debug可以以调试模式启动JRockit Mission Control,这样可以在运行时输出更多信息。启用调试模式会使JRockit Mission Control的各子系统的行为有些许改变,例如控制台图表会展示渲染信息,会改变日志等级,记录更详细的输出内容。

若要在Windows系统中查看发送给控制台的日志信息,需要将标准错误(stderr)重定向到其他地方,这是因为加载器jrmc是由加载器javaw加载的,默认不会产生控制台输出。要想查看日志信息,可以使用类似如下的命令启动JRockit Mission Control:

D:\>%JROCKIT_HOME%\bin\jrmc –consoleLog -debug 2>&1 | more

若只想修改日志等级,可以在Preferences菜单中选择一个日志配置文件。日志配置文件需要符合标准的java.util.logging格式。在修改日志配置后,需要重新启动JRockit Mission Control来使之生效。

下面是一个日志配置文件的示例:

############################################################
# JRockit Mission Control Logging Configuration File
#
# This file can be overridden by setting the path to another
# settings file in the Mission Control preferences.
############################################################

############################################################
# Global properties
############################################################

# "handlers" specifies a comma separated list of log Handler
# classes. These handlers will be installed during ApplicationPlugin
# startup.
# Note that these classes must be on the system classpath.
handlers= java.util.logging.FileHandler,java.util.logging.ConsoleHandler

# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overridden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= ALL

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

# Default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/mc_%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter =
java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level = FINE

############################################################
# Facility specific properties.
# Provides extra control for each logger.
# For example setting the warning level for logging from the
# JRockit Browser, add the following line:
# com.jrockit.mc.browser.level = INFO
############################################################
sun.rmi.level = INFO
javax.management.level = INFO